package com.spremoteservice.android;

import java.io.Serializable;

public class ListViewSPObject implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int icon;
    public String id;
    public String objectType;
    public String title;
    public String siteUrl;
    public String libraryId;
    public String libraryName;
    public String folders;
    public String documentName;
    
    public ListViewSPObject(){
        super();
    }
    
    public ListViewSPObject(String id, String objectType, String title, String siteUrl,
    		String libraryId, String libraryName, String folders, String documentName) {
        super();
        this.id = id;
        if (objectType.equalsIgnoreCase("RootSite")){
        	this.icon = R.drawable.subsite;
        }else if(objectType.equalsIgnoreCase("SubSite")){
        	this.icon = R.drawable.subsite;
        }else if(objectType.equalsIgnoreCase("Library")){
        	this.icon = R.drawable.library;
        }else if(objectType.equalsIgnoreCase("Folder")){
        	this.icon = R.drawable.folder;
        }else if(objectType.equalsIgnoreCase("Document")){
        	String extension = FileNameUtils.getExtension(documentName);
        	
        	if (extension.equals("pptx") || extension.equals("ppt")){
        		this.icon = R.drawable.powerpoint2;
        	}else if (extension.equals("docx") || extension.equals("doc")){
        		this.icon = R.drawable.ms_word_2;
        	}else if (extension.equals("xlsx") || extension.equals("xls")){
        		this.icon = R.drawable.excel2;
        	}else if (extension.equals("txt")){
        		this.icon = R.drawable.text;
        	}else if (extension.equals("pdf")){
        		this.icon = R.drawable.pdf;
        	}else if (extension.equals("png") || extension.equals("bmp") || extension.equals("jpg") || extension.equals("jpeg")){
        		this.icon = R.drawable.image;
        	}else {
        		this.icon = R.drawable.unknown;
        	}

        }
        this.objectType = objectType;
        this.title = title;
        this.siteUrl = siteUrl;
        this.libraryId = libraryId;
        this.libraryName = libraryName;
        this.folders = folders;
        this.documentName = documentName;
    }
    
    public ListViewSPObject(int icon, String title) {
    	super();
    	this.icon = icon;
    	this.title = title;
    }
}